﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MockPrjTeam1.DAO;
using MockPrjTeam1.Entity;
using MockPrjTeam1.Biz;
using System.Data;

namespace MockPrjTeam1.Biz
{
    public class ContactBiz
    {
        public List<Contact> GetAll()
        {
            var dao = new ContactDAO();
            return dao.GetAll();
        }
        //public static DataTable Search(string fistname, string surname)
        //{ 
           
        //    string sql = "select ContactName,MobilePhone,EmailAddress,ContactType,Active from Contact";
        //    DataTable table = ContactDAO.GetDataToTable(sql);
        //    return table;
        //}

        public bool Save(Contact contact)
        {
            var dao = new ContactDAO();
            return dao.Save(contact);

        }
        
        public List<Contact> SearchContact(string FirstName, string SurName)
        {
            var dao = new ContactDAO();
            return dao.SearchContact(FirstName, SurName);
        }
        public Contact GetOne(int id)
        {
            var dao = new ContactDAO();
            return dao.GetOne(id);
        }
        public bool EditContact(Contact Entity)
        {
            var dao = new ContactDAO();
            var result = dao.EditContact(Entity);
            if (result)
                return true;
            else return false;
        }
    }
}